/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package testing.jee.entity;

import java.util.Collection;
import java.util.Date;
import java.util.HashSet;

/**
 *
 * @author kreisera
 */
public class Workday {
    
    private int hoursLeft = 8;
    private Date date;
    private boolean holiday;
    private Collection<Workpackage> workpackages = new HashSet<Workpackage>();

    public int getHoursLeft() {
        return hoursLeft;
    }

    public void setHoursLeft(int hoursLeft) {
        this.hoursLeft = hoursLeft;
    }
    
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Collection<Workpackage> getWorkpackages() {
        return workpackages;
    }

    public void addWorkpackage(Workpackage workpackage) {
        workpackages.add(workpackage);
        hoursLeft -= workpackage.getDuration();
    }

    public boolean isHoliday() {
        return holiday;
    }

    public void setHoliday(boolean holiday) {
        this.holiday = holiday;
    }
}